// pages/bookseats/bookseats.js

const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    selectNum: 0,
    person_num: '',
    selectDay: 0,
    day: '',
    selectTime: 0,
    time: '',
    selectSeat: 0,
    seat: '',
    list_p: [{
      id: 1,
      num: "1人"
    }, {
      id: 2,
      num: "2人"
    }, {
      id: 3,
      num: "3人"
    }, {
      id: 4,
      num: "4人"
    }, {
      id: 5,
      num: "5人"
    }],
    list_d: [],
    list_t: [{
      id: 1,
      types: "豪华小包(4~6人)"
    }, {
      id: 2,
      types: "豪华中包(6~10人)"
    }, {
      id: 3,
      types: 'VIP中包(10~20人)'
    }],
    list_dur: [{
      id: 1,
      time: '12:00~13:00',
      during:'1小时',
      prive:'11.9'
    }, {
      id: 2,
      time: '12:00~18:00',
      during: '6小时',
      prive: '57'
    }, {
      id: 3,
      time: '19:00~02:00',
      during: '7小时',
      prive: '192'
    }]

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

    var dateAry = [];

    for (var i = 0; i < 5; i++) {
      console.log(app.util.getDateStr(i));
      var obj = {};
      obj.id = i + 1;
      obj.date = app.util.getDateStr(i);

      dateAry.push(obj)
    }
    console.log(dateAry,'日期');
    this.setData({
      list_d: dateAry,
      day: app.util.getNowTime(),
      time: this.data.list_t[0].types,
      person_num: this.data.list_p[0].num,
      seat: this.data.list_dur[0].time
    })


  },
  positionNumTap: function (e) {
    console.log(e.currentTarget.dataset.index);
    var index = e.currentTarget.dataset.index;
    var num = e.currentTarget.dataset.num;
    this.setData({
      selectNum: index,
      person_num: num
    })
  },
  positionDayTap: function (e) {
    console.log(e.currentTarget.dataset.index);
    var index = e.currentTarget.dataset.index;
    var date = e.currentTarget.dataset.date;
    this.setData({
      selectDay: index,
      day: date
    })
  },
  positionTimeTap: function (e) {
    var index = e.currentTarget.dataset.index;
    var time = e.currentTarget.dataset.time;
    this.setData({
      selectTime: index,
      time: time

    })
  },
  positionSeatTap: function (e) {
    var index = e.currentTarget.dataset.index;
    var seat = e.currentTarget.dataset.seat;
    this.setData({
      selectSeat: index,
      seat: seat
    })
  },
  yuding: function () {
    console.log("确定订座");
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})